home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / vol16n13.zip / ATLCTL.ZIP / AtlEdit10.cpp < prev    next >
C/C++ Source or Header  |  1997-01-25  |  2KB  |  79 lines

  1. // AtlEdit10.cpp : Implementation of DLL Exports.
  2.  
  3. // You will need VC 4.2 and the full 4.2b patch (http://msvc/vc42b/vc42b.htm) in 
  4. // order to build this project.  This patch includes the final NT 4.0 SDK.
  5. // You will also need MIDL 3.00.75, which is included with ATL 2.0.
  6.  
  7. // Note: Proxy/Stub Information
  8. //        To build a separate proxy/stub DLL, 
  9. //        run nmake -f AtlEdit10ps.mk in the project directory.
  10.  
  11. #include "stdafx.h"
  12. #include "resource.h"
  13. #include "AtlEdit10.h"
  14.  
  15. #include "AtlEdit10_i.c"
  16. #include "AtlEditCtl.h"
  17.  
  18.  
  19. CComModule _Module;
  20.  
  21. BEGIN_OBJECT_MAP(ObjectMap)
  22.     OBJECT_ENTRY(CLSID_AtlEditCtl, CAtlEditCtl)
  23. END_OBJECT_MAP()
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // DLL Entry Point
  27.  
  28. extern "C"
  29. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  30. {
  31.     if (dwReason == DLL_PROCESS_ATTACH)
  32.     {
  33.         _Module.Init(ObjectMap, hInstance);
  34.         DisableThreadLibraryCalls(hInstance);
  35.     }
  36.     else if (dwReason == DLL_PROCESS_DETACH)
  37.         _Module.Term();
  38.     return TRUE;    // ok
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Used to determine whether the DLL can be unloaded by OLE
  43.  
  44. STDAPI DllCanUnloadNow(void)
  45. {
  46.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Returns a class factory to create an object of the requested type
  51.  
  52. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  53. {
  54.     return _Module.GetClassObject(rclsid, riid, ppv);
  55. }
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59.  
  60. STDAPI DllRegisterServer(void)
  61. {
  62.     // registers object, typelib and all interfaces in typelib
  63.     return _Module.RegisterServer(TRUE);
  64. }
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // DllUnregisterServer - Removes entries from the system registry
  68.  
  69. STDAPI DllUnregisterServer(void)
  70. {
  71.     _Module.UnregisterServer();
  72. #if _WIN32_WINNT >= 0x0400
  73.     UnRegisterTypeLib(LIBID_ATLEDIT10Lib, 1, 0, LOCALE_USER_DEFAULT, SYS_WIN32);
  74. #endif
  75.     return S_OK;
  76. }
  77.  
  78.  
  79.